$("#hearder").on("click","img",function(){
	history.go(-1)
})
var id=getUrlParam("id")
getData(id)
function getData(id){
		$.ajax({
    	type:"get",
    	url:Url+"getAdminDetail/"+id,
    	async:false,
    	beforeSend: function () {
    			
		},
		complete: function () {
			
		},
    	success: function(data){
           console.log(data);
           setOrderDetails(data)
          }
    	});
}


    function setOrderDetails(data) {
        $(".otn-time").text(data.createtime);
        $(".otn-num").text(data.order_number);
        var status = '';
        if (data.order_states == 1) {
            status = '未付款';                                  
        } else if (data.order_states == 2) {
            status = '已付款';
        } else if (data.order_states == 3) {
            status = '已发货';
            $(".order_states_1").show();           
        } else if (data.order_states == 5) {
            status = '已取消';
        } else if (data.order_states == 6) {
            status = '待评价';
            $(".order_states_1").show();    
        } else if (data.order_states == 7) {
            status = '已完成';
            $(".order_states_1").show();    
        }
      
        
        $(".tell-contact").attr("href","logisticsInformation.html?id="+data.order_id)
        $(".name").text(data.nickname)
        $(".state").text(status);
        $(".cmt-num").eq(0).text(data.snap_name)
        var str1 = '';
        for (var k in data.snap_items.speci_snap) {
            str1 += k + ':' + data.snap_items.speci_snap[k] ;
        }
        $(".cmt-num").eq(1).text(str1)
        $(".cmt-num").eq(2).text(data.snap_items.price)
        $(".cmt-num").eq(3).text(data.snap_items.counts)
        $(".orderDetails-main-img").attr("src",data.snap_img)
        $(".o-i-a-name").text(data.snap_address.uaddres_name)
        $(".o-i-a-num").text(data.snap_address.uaddres_mobile)
        $(".o-i-a-add").text(data.snap_address.uaddres_province + data.snap_address.uaddres_city + data.snap_address.uaddres_county + data.snap_address.uaddres_detail)
        $(".o-i-s-total").children(".o-i-s-r").text("￥" + data.total_price)
        $(".o-i-p-r").text("￥" + data.total_price)
        $(".online-contact").attr("href","chat.html?id="+data.user_id)
    }
    
$("#main").on("click",".online-contact",function(){
	var kefu=JSON.parse(storage.getItem("userinfo"));
	if(kefu.user_id==null){
		taostr("此账号暂未开通客服功能！",1000);
		return false;
	}
})